document.addEventListener('DOMContentLoaded', () => {
      const chart = echarts.init(document.getElementById('chart'));

      // 接收Native数据
      window.addEventListener('message', ({
        data
      }) => {
        
        console.log('data',data)
        chart.setOption(data);
      });

      chart.setOption({
        title: {
          text: '缺陷分布',
          left: 'center'
        },
        tooltip: {
          trigger: 'item'
        },
        legend: {
          orient: 'vertical',
          left: 'left',
          data: ['缺陷一', '缺陷二', '缺陷三', '缺陷四', '缺陷五']
        },
        series: [{
          name: '缺陷占比',
          type: 'pie',
          radius: '55%',
          data: [
            {
              value: 20,
              name: '缺陷一',
              itemStyle: {
                color: '#C1232B'
              }
            },
            {
              value: 20,
              name: '缺陷二',
              itemStyle: {
                color: '#B5C334'
              }
            },
            {
              value: 30,
              name: '缺陷三',
              itemStyle: {
                color: '#FCCE10'
              }
            },
            {
              value: 20,
              name: '缺陷四',
              itemStyle: {
                color: '#E87C25'
              }
            },
            {
              value: 30,
              name: '缺陷五',
              itemStyle: {
                color: '#27727B'
              }
            }
          ],
          emphasis: {
            itemStyle: {
              shadowBlur: 10,
              shadowOffsetX: 0,
              shadowColor: 'rgba(0, 0, 0, 0.5)'
            }
          }
        }]
      });